import Common from './common'

export default {
  user_login (user) {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.USER_LOGIN), method: 'post', data: user })
  },
  user_logout () {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.USER_LOGOUT), method: 'get', data: {} })
  },
  get_stores_count () {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.GET_STORES_COUNT), method: 'get', data: null })
  },
  get_stores (status, pageIndex, pageCount) {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.GET_STORES + status + '?pageIndex=' + pageIndex + '&pageCount=' + pageCount), method: 'get', data: null })
  },
  update_store (store) {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.UPDATE_STORE + store['id']), method: 'post', data: store })
  },
  get_ads_count () {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.GET_ADS_COUNT), method: 'get', data: null })
  },
  get_ads (status, pageIndex, pageCount) {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.GET_ADS + status + '?pageIndex=' + pageIndex + '&pageCount=' + pageCount), method: 'get', data: null })
  },
  update_ad (ad) {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.UPDATE_AD + ad['id']), method: 'post', data: ad })
  },
  get_complains_count () {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.GET_COMPLAINS_COUNT), method: 'get', data: null })
  },
  get_complains (status, pageIndex, pageCount) {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.GET_COMPLAINS + status + '?pageIndex=' + pageIndex + '&pageCount=' + pageCount), method: 'get', data: null })
  },
  update_complain (complain) {
    return Common.request({ url: Common.getApiUrl(Common.ELE_MONKEY_SERVER_URL.ADMINISTRATOR, Common.ELE_MONKEY_API.ADMINISTRATOR.UPDATE_COMPLAIN + complain['id']), method: 'post', data: complain })
  }
}
